﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Twi.COMMON.WPF;
using Twi.COMMON.HTTP;

namespace Twi.COMMON.WPF
{
    public class DataCache
    {
        private static List<XElement> _deptProperty;

        public static List<XElement> DeptProperty
        {
            get {
                if (_deptProperty == null)
                {
                    GetDeptProperty();
                }
                return _deptProperty; 
            }
        }

        #region 获取部门属性
        /// <summary>
        /// 获取部门属性
        /// </summary>
        private static void GetDeptProperty()
        {
            using (var res = "Department/GetDeptPropertyList".HttpGet())
            {
                ProcessRequest.Process(res, (ResponseMessageInfo resInfo) =>
                {
                    _deptProperty = resInfo.ResponseDataMainBody.Elements().ToList();
                });
            }
        }
        #endregion
    }
}
